package com.example.config;

import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Auther:
 * @Description:
 * @Date: 2019/12/23 16:08
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    /**
     * 构建 API 文档信息
     *
     * @return
     */
    public ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("boot-redis-swagger")
                .contact(new Contact("ZhangGQ", "", ""))
                .version("10.v")
                .description("描述").build();
    }

    /**
     * 配置
     *
     * @return
     */
    public Docket createDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.guoq.rabbitmq.boot.client.boot_rabbitmq_client01.controller"))
                .paths(PathSelectors.any())
                .build();
    }
}
